<?php
namespace app\admin\validate;

use think\Validate;

class RoleValidate extends Validate
{
    protected $rule = [
        'name' => 'require|unique:Role',
        "id" => 'require',
        "nodes"=>'require|min:1|array',
        "status" => 'require|in:1,-1',
    ];

    protected $message = [
        'name.require' => '角色名称必须填写',
        'name.unique' => '角色名称已经存在',
        "id.require" => "缺少id",
        "nodes.require" => "节点不能为空",
        "nodes.min"=>"节点不能为空",
        "nodes.array"=>"节点必须是数组",
        "status.in" => "状态值错误",
        "status" => "缺少状态值"
    ];

    protected $scene = [
        'add' => ['name','nodes'],
        'edit' => ['name','nodes','id'],
        'status'=>['id','status'],
        'remove'=>['id']
    ];
}